package GUI;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;


//import javax.swing.JButton;

/**
 * This class generates special buttons. The buttons change their appearance, if a user moves the
 * mousepointer over it, and if they are clicked.
 * @author Wayang Group Bremen
 * @version 0.9
 */
public class ButtonGui extends JButton implements MouseListener {

	private static final long serialVersionUID = 1L;

	public ButtonGui(ImageIcon icon) {

        super(icon);
        super.setBackground(new Color(0,0,0,0));
        super.setBorder(null);
        super.setOpaque(false);
        this.setIcon(icon);
        super.setContentAreaFilled(false);
        this.addMouseListener(this);
    }

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseClicked(MouseEvent e) {
		// do something.
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
	 */
	@Override
	public void mousePressed(MouseEvent e) {
		// do something.
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseReleased(MouseEvent e) {
		// do something.
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseEntered(MouseEvent e) {
		if (e.getComponent() instanceof ButtonGui) {
			Cursor hand = new Cursor(Cursor.HAND_CURSOR);
			setCursor(hand); 
			// do any operation on this button.

		}
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		if (e.getComponent() instanceof ButtonGui) {
			// do any operation on this button.
		}
	}
}


